<template>
	<div>
		<div class="searchWord">
			<el-form :inline="true" class="demo-form-inline">
				<el-form-item label="状态" >
					<el-select clearable v-model="listEvaluationParam.evaluationStatus" placeholder="请选择" style="width: 150px;">
						<el-option label="待鉴定" value="0">
						</el-option>
						<el-option label="待评估" value="1">
						</el-option>
						<el-option label="已评估" value="2">
						</el-option>
						<el-option label="无效" value="3">
						</el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="模糊条件">
					<el-input style="width: 150px;" placeholder="请输入内容" v-model="listEvaluationParam.keyword" clearable>
					</el-input>
				</el-form-item>
				<el-form-item label="操作人">
					<el-input style="width: 150px;" placeholder="请输入内容" v-model="listEvaluationParam.evaluationOperator" clearable>
					</el-input>
				</el-form-item>
				<el-form-item label="录入日期">
					 <div class="block">
					    <el-date-picker v-model=""  type="daterange"  range-separator="" 
						 start-placeholder=""  end-placeholder="">
					    </el-date-picker>
					  </div>
				</el-form-item>
			</el-form>
			<el-form :inline="true" class="demo-form-inline">
				<el-form-item>
					<el-button type="primary" round="true" @click="loadEvaluation(1)">查询</el-button>
				</el-form-item>
				<el-form-item>
					<el-button type="success" round="true" @click="openAdd ">添加</el-button>
				</el-form-item>
				<el-form-item>
					<el-button :disabled="ids.length <= 0" type="danger" @click="delShop">删除</el-button>
				</el-form-item>
				<el-form-item>
					<el-button type="success" round="true" @click="openUpdate">修改</el-button>
				</el-form-item>
			</el-form>
		</div>
		<div>
			<el-table :data="evaluations" @selection-change="getChecks">
				<el-table-column type="selection" label="序号">
				</el-table-column>
				<el-table-column type="index" label="序号">
				</el-table-column>
				<el-table-column prop="goodsName" label="商品名称">
				</el-table-column>
				<el-table-column prop="" label="分类">
				</el-table-column>
				<el-table-column prop="enteredName" label="录入人">
				</el-table-column>
				<el-table-column prop="appraiserName" label="鉴定人">
				</el-table-column>
				<el-table-column prop="userName" label="评估人">
				</el-table-column>
				<el-table-column prop="evaluationEnterTime" label="录入时间">
				</el-table-column>
				<el-table-column label="状态">
					<template slot-scope="scope">
						{{ scope.row.evaluationStatus == 0 ? '待鉴定' : scope.row.evaluationStatus == 1 ? '待评估': scope.row.evaluationStatus == 2 ? '已评估':'无效' }}
					</template>
				</el-table-column>
			</el-table>
		</div>
		<div>
			<el-pagination :page-sizes="sizes" @size-change="sizeChangeFind" :current-page="listEvaluationParam.indexPage"
				@current-change="changePage" background layout="sizes, prev, pager, next" :total="total"
				:page-size="listEvaluationParam.pageSize">
			</el-pagination>
		</div>
		<el-dialog @close="clearAddForm" title="新增评估信息" :visible.sync="addMovieVisible">
			<div>
				<el-form>
					<el-form-item label="商品名称">
						<el-input v-model="saveEvaluationParam.goodsName"></el-input>
					</el-form-item>
					<el-form-item label="分类">
						<el-input v-model=""></el-input>
					</el-form-item>
					<el-form-item label="录入人">
						<el-input v-model="saveEvaluationParam.enteredName"></el-input>
					</el-form-item>
					<el-form-item label="鉴定人">
						<el-input v-model="saveEvaluationParam.appraiserName"></el-input>
					</el-form-item>
					<el-form-item label="评估人">
						<el-input v-model="saveEvaluationParam.userName"></el-input>
					</el-form-item>
					<el-form-item label="录入时间">
						<el-input v-model="saveEvaluationParam.evaluationEnterTime"></el-input>
					</el-form-item>
					<el-form-item label="状态">
						<template>
							<el-radio v-model="saveEvaluationParam.evaluationStatus" label="0">待鉴定</el-radio>
							<el-radio v-model="saveEvaluationParam.evaluationStatus" label="1">待评估</el-radio>
							<el-radio v-model="saveEvaluationParam.evaluationStatus" label="2">已评估</el-radio>
							<el-radio v-model="saveEvaluationParam.evaluationStatus" label="3">无效</el-radio>
						</template>
					</el-form-item>
				</el-form>
			</div>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="saveShop">提 交</el-button>
			</div>
		</el-dialog>
	<!-- 	<el-dialog @close="clearUpForm" title="修改评估信息" :visible.sync="UpdateVisible">
			<div>
				<el-form>
					<el-form-item label="商品名称">
						<el-input v-model="updateEvaluationParam.goodsName"></el-input>
					</el-form-item>
					<el-form-item label="分类">
						<el-input v-model=""></el-input>
					</el-form-item>
					<el-form-item label="录入人">
						<el-input v-model="updateEvaluationParam.enteredName"></el-input>
					</el-form-item>
					<el-form-item label="鉴定人">
						<el-input v-model="updateEvaluationParam.appraiserName"></el-input>
					</el-form-item>
					<el-form-item label="评估人">
						<el-input v-model="updateEvaluationParam.userName"></el-input>
					</el-form-item>
					<el-form-item label="录入时间">
						<el-input v-model="updateEvaluationParam.evaluationEnterTime"></el-input>
					</el-form-item>
					<el-form-item label="状态">
						<el-radio-group v-model="updateShopParam.evaluationStatus">
							<el-radio :label="0">待鉴定</el-radio>
							<el-radio :label="1">待评估</el-radio>
							<el-radio :label="2">已评估</el-radio>
							<el-radio :label="3">无效</el-radio>
						</el-radio-group>
					</el-form-item>
				</el-form>
			</div>

			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="Update">提 交</el-button>
			</div>
		</el-dialog> -->
	</div>
</template>

<script>
	export default {
		data() {
			return {
				listEvaluationParam: {
					indexPage: 1,
					pageSize: 3,
					keyword: null,
					evaluationStatus: null,
					evaluationOperator:null,
					evaluationEnterStartDate:null,
					evaluationEnterEndDate:null
				},
				total: 0,
				sizes: [1, 2, 3, 5, 10, 20],
				evaluations: [],
				ids: [],
				addMovieVisible: false,
				UpdateVisible: false,
				saveEvaluationParam: {
					goodsName:null,
					enteredName:null,
					appraiserName:null,
					userName:null,
					evaluationStatus: null,
					evaluationEnterTime:null
				},
				updateEvaluationParam: {
					goodsName:null,
					enteredName:null,
					appraiserName:null,
					userName:null,
					evaluationStatus: null,
					evaluationEnterTime:null
				},
			}
		},
		methods: {
		
			//查询评估信息
			loadEvaluation(page) {
				if (page != undefined) {
					this.listEvaluationParam.indexPage = page;
				}
				this.$http.post("/goods-evaluation/queryEvaluation", this.listEvaluationParam).then(resp => {
					this.evaluations = resp.data.data.evaluationDtoList;
					this.total = resp.data.data.total;
					this.listEvaluationParam.indexPage = resp.data.data.indexPage;
				})
			},
			getChecks(sel) {
				this.ids = [];
				for (let i = 0; i < sel.length; i++) {
					this.ids.push(sel[i].evaluationId);
				}
			},
			sizeChangeFind(size) {
				this.listEvaluationParam.pageSize = size;
				this.loadEvaluation();
			},
			changePage(page) {
				this.listEvaluationParam.indexPage = page;
				this.loadEvaluation();
			},
			
			saveShop() {
				this.$http.post("/shop-table/saveShop", this.saveEvaluationParam).then(resp => {
			
					if (resp.data.code == 200) {
						this.addMovieVisible = !this.addMovieVisible;
						this.$message({
							message: '添加成功',
							type: 'success',

						});
						this.loadEvaluation();
						this.clearAddForm();

					} else {
						this.$message.error('添加失败');
					}
				})
			},
			openAdd() {
				this.addMovieVisible = !this.addMovieVisible;
				this.loadEvaluation();
			},

			clearAddForm() {
				this.saveEvaluationParam = {
					goodsName:null,
					enteredName:null,
					appraiserName:null,
					userName:null,
					evaluationStatus: null,
					evaluationEnterTime:null
				}
			},
			clearUpForm() {
				this.updateShopParam = {
					goodsName:null,
					enteredName:null,
					appraiserName:null,
					userName:null,
					evaluationStatus: null,
					evaluationEnterTime:null
				}
			},
			
			
		},
		created() {
			this.loadEvaluation();

		}
	}
</script>

<style>
</style>
